package org.sao.security.demo.aspect;

import java.util.Date;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;
;

//@Aspect
//@Component
public class TimeAspect {
	
	@Around("execution(* org.sao.security.demo.controller.UserController.*(..))")
	public Object handleControllerMethod(ProceedingJoinPoint pr) throws Throwable{
		System.out.println("time aspect start");
		Object[] args =pr.getArgs();
		for(Object ob:args){
			System.out.println("arg:"+ob);
		}
		Long startTime=new Date().getTime();
		Object object=pr.proceed();
		System.out.println("time aspect 耗时:"+(new Date().getTime()-startTime));
		System.out.println("time aspect end");
		return object;
	}

}
